package house;

import java.util.ArrayList;

import returnTypes.Status;
import room.Room;
import room.RoomArray;
import tester.RoomTester;

public class House {
	private ArrayList<Room> rooms=null;
	private HouseSketch sketch= null;
	private String name=null;
	private Status state;
	
	public House(RoomArray newRooms,RoomTester tester)
	{
		rooms= newRooms.getAllRooms();
		sketch=new HouseSketch();
		sketch.importMatrix(tester.parseMatrix());
	}
	
	public HouseSketch getSketch() {
		return sketch;
	}

	public void setSketch(HouseSketch sketch) {
		this.sketch = sketch;
	}

	public House()
	{
		rooms= new ArrayList<Room>();
	}	
	
	public Room getRoom(int index)
	{
		if (index<rooms.size())
		return rooms.get(index);
		else return null;
	}
	
	public Room getRoom(String roomName)
	{
		for(int i=0;i<rooms.size();i++)
			if (rooms.get(i).getRoomName().equals(roomName)) return rooms.get(i);
		return null;
	}
	
	public void printSketch()
	{
		sketch.printSketch();
	}
	
	public void printHouse()
	{
		System.out.println("House formed of following rooms: ");
		for(int i=0;i<rooms.size();i++)
		{
			rooms.get(i).printRoom();
		}
		System.out.println();
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setState(Status state) {
		this.state = state;
	}

	public Status getState() {
		return state;
	}
	

}
